home *** CD-ROM | disk | FTP | other *** search
/ IRIX Patches 1995 March / SGI IRIX Patches 1995 Mar.iso / 5.3_patches / patchSG0000304 / patchSG0000304.idb / usr / include / aio.h.z / aio.h
Encoding:
C/C++ Source or Header  |  1995-03-10  |  6.3 KB  |  185 lines

  1. /*************************************************************************
  2. *                                                                        *
  3. *               Copyright (C) 1992,1994 Silicon Graphics, Inc.            *
  4. *                                                                        *
  5. *  These coded instructions, statements, and computer programs  contain  *
  6. *  unpublished  proprietary  information of Silicon Graphics, Inc., and  *
  7. *  are protected by Federal copyright law.  They  may  not be disclosed  *
  8. *  to  third  parties  or copied or duplicated in any form, in whole or  *
  9. *  in part, without the prior written consent of Silicon Graphics, Inc.  *
  10. *                                                                        *
  11. **************************************************************************/
  12. #ident  "$Revision: 1.6 $ $Author: jeffreyh $"
  13.  
  14. #ifndef __AIO_H__
  15. #define __AIO_H__
  16.  
  17. #ifdef __cplusplus
  18. extern "C" {
  19. #endif
  20.  
  21. #include <sys/types.h>
  22. #include <sys/signal.h>
  23. #include <sys/timers.h>
  24. #include <sys/fcntl.h>
  25.  
  26. #ifdef  _ABI_SOURCE
  27. /*
  28.  * aio - POSIX 1003.1b-1993
  29.  */
  30.  
  31. typedef struct aiocb {
  32.     int    aio_fildes;        /* file descriptor to perform aio on */
  33.     volatile void *aio_buf;     /* Data buffer */
  34.     size_t    aio_nbytes;    /* number of bytes of data */
  35.     off_t    aio_offset;    /* file offset position */
  36.     int        aio_reqprio;    /* aio priority, (Currently must be 0) */
  37.     sigevent_t    aio_sigevent;    /* notification information */
  38.     int        aio_lio_opcode;    /* opcode for lio_listio() call */
  39.     ulong    aio_reserved[7];/* reserved for internal use */
  40.     ulong    aio_pad[6];
  41. } aiocb_t;
  42.  
  43. /* for aio_cancel() return values */
  44. #define AIO_CANCELED    1    /* cancelled operation */
  45. #define AIO_NOTCANCELED 2    /* some ops not cancelled */
  46. #define AIO_ALLDONE    3    /* all aio has completed */
  47.  
  48. /* for aiocb.aio_lio_opcode */
  49. #define LIO_NOP        0    /* listio request with no data */
  50. #define LIO_READ    1    /* listio read request */
  51. #define LIO_WRITE    2    /* listio write request */
  52.  
  53. /* for lio_listio mode flag */
  54. #define LIO_WAIT    4    /* blocks until lio_listio complete */
  55. #define LIO_NOWAIT    3    /* asynchronous lio_listio call, doesn't block */
  56.  
  57. /* for lio_hold routine */
  58. #define AIO_HOLD_CALLBACK    1
  59. #define AIO_RELEASE_CALLBACK    2
  60. #define AIO_ISHELD_CALLBACK    3
  61.  
  62. #if defined(_SGI_SOURCE)
  63. /* These defines are not for use by applications. */
  64. #define _AIO_SGI_LISTIO_MAX    2048
  65. #define _AIO_SGI_MAX        2048
  66. #define _AIO_SGI_PRIO_DELTA_MAX    0
  67. #endif
  68. #if !defined(_POSIX_SOURCE)
  69. /*
  70.  * This stucture is the optional argument to aio_sgi_init. The defaults
  71.  * that are used if NULL is given as the argument are in parentheses at the
  72.  * end of each comment.
  73.  */
  74. typedef struct aioinit {
  75.     int aio_threads;    /* The number of threads started (5) */
  76.     int aio_locks;    /* Initial number of preallocated locks (3) */
  77.     int aio_num;    /* estimated total simultanious aiobc structs (1000) */
  78.     int aio_usedba;    /* Try to use DBA for raw I/O in lio_listio (0) */
  79.     int aio_debug;    /* turn on debugging (0) */
  80.     int aio_numusers;    /* max number of user sprocs making aio_* calls (5) */
  81.     int aio_reserved[3];        
  82. } aioinit_t;
  83. #endif /* !_POSIX_SOURCE */
  84. #ifndef aio_init
  85. #define aio_init() aio_sgi_init(NULL);
  86. #endif /* aio_init */
  87. extern void aio_sgi_init(aioinit_t *);
  88. extern int aio_read(aiocb_t *);
  89. extern int aio_write(aiocb_t *);
  90. extern int lio_listio(int, aiocb_t * const [], int, sigevent_t *);
  91. extern int aio_cancel(int, aiocb_t *);
  92. extern int aio_error(const aiocb_t *);
  93. extern ssize_t aio_return(aiocb_t *);
  94. extern int aio_suspend(const aiocb_t * const [], int, const timespec_t *);
  95. extern int aio_fsync(int, aiocb_t *);
  96. extern int aio_hold(int);
  97. #if(defined(_SGI_SOURCE) && !defined(_POSIX_SOURCE) && !defined(_XOPEN_SOURCE)) 
  98. typedef struct aiocb64 {
  99.     int    aio_fildes;        /* file descriptor to perform aio on */
  100.     volatile void *aio_buf;     /* Data buffer */
  101.     size_t    aio_nbytes;    /* number of bytes of data */
  102. #if (_MIPS_SZLONG == 32)
  103.     off_t    aio_oldoff;    /* old: file offset position */
  104. #else
  105.     off_t    aio_offset;    /* file offset position */
  106. #endif
  107.     int        aio_reqprio;    /* aio priority, (Currently must be 0) */
  108.     sigevent_t    aio_sigevent;    /* notification information */
  109.     int        aio_lio_opcode;    /* opcode for lio_listio() call */
  110.     ulong    aio_reserved[7];/* reserved for internal use */
  111.     ulong    aio_pad[6];
  112. #if (_MIPS_SZLONG == 32)
  113.     off64_t    aio_offset;    /* file offset position */
  114. #endif
  115. } aiocb64_t;
  116. extern void aio_sgi_init64(aioinit_t *);
  117. extern int aio_read64(aiocb64_t *);
  118. extern int aio_write64(aiocb64_t *);
  119. extern int lio_listio64(int, aiocb64_t * const [], int, sigevent_t *);
  120. extern int aio_cancel64(int, aiocb64_t *);
  121. extern int aio_error64(const aiocb64_t *);
  122. extern ssize_t aio_return64(aiocb64_t *);
  123. extern int aio_suspend64(const aiocb64_t * const [], int, const timespec_t *);
  124. extern int aio_fsync64(int, aiocb64_t *);
  125. #endif
  126.  
  127. #else /* _ABI_SOURCE */
  128. /*
  129.  * aio - POSIX 1003.4 Draft 12
  130.  */
  131.  
  132. typedef struct aiocb {
  133.     /* defined by Posix.4 D12 */
  134.     int    aio_fildes;    /* file descriptor to perform aio on */
  135.     off_t    aio_offset;    /* file offset position */
  136.     volatile void *aio_buf;
  137.     size_t    aio_nbytes;
  138.     int    aio_reqprio;    /* aio priority, larger values lowers pri */
  139.     sigevent_t aio_sigevent;/* signal to be generated on completion */
  140.     int    aio_lio_opcode;    /* opcode for lio_listio() call */
  141.     /* SGI defined */
  142.     size_t    aio_nobytes;    /* return bytes */
  143.     int    aio_whence;    /* for seeking */
  144.     int    aio_errno;    /* return error from this aio op */
  145.     int    aio_ret;    /* returned status */
  146. } aiocb_t;
  147.  
  148.  
  149. /* for aio_cancel() return values */
  150. #define AIO_CANCELED    1    /* cancelled operation */
  151. #define AIO_NOTCANCELED 2    /* some ops not cancelled */
  152. #define AIO_ALLDONE    3    /* all aio has completed */
  153.  
  154. /* for aiocb.aio_lio_opcode */
  155. #define LIO_READ    1
  156. #define LIO_WRITE    2
  157. #define LIO_NOP        3
  158.  
  159. /* for lio_listio mode flag */
  160. #define LIO_WAIT    1
  161. #define LIO_NOWAIT    2
  162.  
  163. #if defined(_SGI_SOURCE)
  164. #define _AIO_LISTIO_MAX        255
  165. #define _AIO_MAX        4
  166. #define _AIO_PRIO_DELTA_MAX    100
  167. #endif
  168.  
  169. extern void aio_init(void);
  170. extern int aio_read(struct aiocb *);
  171. extern int aio_write(struct aiocb *);
  172. extern int lio_listio(int, struct aiocb *[], int, sigevent_t *);
  173. extern int aio_cancel(int, struct aiocb *);
  174. extern int aio_error(struct aiocb *);
  175. extern ssize_t aio_return(struct aiocb *);
  176. extern int aio_suspend(const struct aiocb *[], int, timespec_t *);
  177. extern int aio_fsync(int, struct aiocb *);
  178. #endif /*  _ABI_SOURCE */
  179.  
  180. #ifdef __cplusplus
  181. }
  182. #endif
  183.  
  184. #endif /* __AIO_H__ */
  185.